package com.hwd.gmall.product.controller;

import com.alibaba.fastjson.JSONObject;
import com.hwd.gmall.common.aspect.HwdCache;
import com.hwd.gmall.product.service.IndexService;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

/**
 * 前端首页使用分类查询接口
 *
 * @author 黄伟东/Victor
 * @date 2022/4/26 15:34
 */
@RestController
@RequestMapping(value = "/index/product")
public class IndexController {

    @Resource
    private IndexService indexService;

    /**
     * 查询首页分类信息
     *
     * @return java.util.List<com.alibaba.fastjson.JSONObject>
     */
    @GetMapping(value = "/getIndexCategory")
    @HwdCache(prefix = "getIndexCategory:")
    public List<JSONObject> getIndexCategory() {
        return indexService.listIndexCategory();
    }
}
